package org.video.common.data.model.properties.imp;

import org.video.common.data.model.properties.IProperty;

import java.util.Collection;
import java.util.LinkedList;
import java.util.List;


public abstract class AbstractProperty implements IProperty{

    protected Object data;
    protected List<Object> propertyValues;

    @Override
    public abstract String getName();

    @Override
    public abstract Object getKey();

    @Override
    public Object getData() {
        return this.data;
    }

    @Override
    public void setData(Object _data) {
        this.data = _data;
    }

    @Override
    public List<Object> getValues(){
        return propertyValues;
    }

    @Override
    public void addValue(Object _value) {
        List<Object> localPropertyValues = propertyValues;
        if (localPropertyValues == null)
            synchronized (AbstractProperty.class){
                localPropertyValues = propertyValues;
                if (localPropertyValues == null){
                    localPropertyValues = new LinkedList<Object>();
                    localPropertyValues.add(_value);
                    propertyValues = localPropertyValues;
                }

            }
    }
}
